package com.sangmo.fts.training.repo;

import com.sangmo.boot.framework.plugin.dataview.spi.jpa.IJpaDataViewRepo;
import com.sangmo.fts.training.model.Training;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TrainingRepo extends IJpaDataViewRepo<Training> {

    List<Training> findByExaminationId(Long examinationId);

    Training findFirstByCreatedByAndBusinessTypeAndModeAndExaminationIdIsNull(Long createdBy, String businessType, String mode);

    Training findFirstByTeamIdAndBusinessTypeAndExaminationIdIsNull(Long teamId, String businessType);

    Training findFirstByExaminationIdAndCreatedBy(Long examinationId, Long createdBy);

    Training findFirstByExaminationIdAndTeamId(Long examinationId, Long teamId);
}
